import ProLayout from '@ant-design/pro-layout';
import { IRouteComponentProps, Link } from 'umi';

import defaultProps from './props';

export default ({ children }: IRouteComponentProps) => {
  return (
    <div style={{ height: '100vh' }}>
      {location.pathname.includes('login') ? (
        children
      ) : (
        <ProLayout
          {...defaultProps}
          contentStyle={{ margin: '8px' }}
          headerRender={false}
          menuItemRender={(item) => <Link to={item.path}>{item.name}</Link>}
          menuHeaderRender={() => (
            <div style={{ color: '#fff', fontWeight: 'bold' }}>企业财务分析软件</div>
          )}
          fixSiderbar
        >
          {children}
        </ProLayout>
      )}
    </div>
  );
};
